﻿<?php
if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
	exit('Access Denied');
}
// var_dump($pluginid); //这是系统自动分配的插件id
loadcache('plugin');
$vars = $_G['cache']['plugin']['nimba_nge'];
$itemname = $vars['mytitle'];

showtableheader('更新缓存');
// 
// 所有缓存文件
$cachearray=array(
	'cache_nimba_nge_piclist.php',
	'cache_nimba_nge_newthread.php',
	'cache_nimba_nge_newreplies.php',
	'cache_nimba_nge_hotthread_7.php',
	'cache_nimba_nge_hotthread_30.php',
	'cache_nimba_nge_newdigest.php',
	);

// 缓存文件目录
$cachepath=DISCUZ_ROOT.'./data/sysdata/';
// 缓存时间
$cache=intval($_G['cache']['plugin']['nimba_nge']['cache']);
$op=addslashes(trim($_GET['op']));
// 判断传参，为update则进行删除操作
if($op=='update'){
	// 遍历删除缓存文件
	foreach($cachearray as $v){
		$file = $cachepath.$v;
		if(is_file($file)){
			unlink($file);
		}
	}
	@file_get_contents($_G['siteurl'].'forum.php');
	echo '<font color="red">[*]</font>缓存更新成功';

}
showsubtitle(array('缓存时间','下次缓存时间','操作'));

if(is_array($cachearray)){
	@include_once $cachepath.$cachearray[0];
	$lasttime = isset($lasttime)?$lasttime:'暂无缓存';
	$nexttime = $lasttime=='暂无缓存'?'暂无缓存':$lasttime + $cache;
	showtablerow('',array(),
		array(
			date('Y-m-d H:i:s',$lasttime),
			date('Y-m-d H:i:s',$nexttime),
			'<a href="'.ADMINSCRIPT.'?action=plugins&operation=config&do='.$pluginid.'&identifier=nimba_nge&pmod=cache&op=update">更新缓存</a>'
		));
}

showtablefooter();
?>